empty preferred content
authorJoey Hess <joeyh@joeyh.name>
Fri, 13 Dec 2024 17:26:48 +0000 (13:26 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 13 Dec 2024 17:26:48 +0000 (13:26 -0400)
* Document that settting preferred content to "" is the same as the
  default unset behavior.
* sync: Avoid misleading warning about future preferred content
  transition when preferred content is set to "".

CHANGELOG
Command/Sync.hs
doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment [new file with mode: 0644]
doc/git-annex-preferred-content.mdwn

index a9e21290ae4f467714a37ffca363e95964e39f80..0e2f177b0bf64fae8dd83122935c4625851f07cd 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,10 @@ git-annex (10.20241203) UNRELEASED; urgency=medium
   * Work around git hash-object --stdin-paths's odd stripping of carriage
     return from the end of the line (some windows infection), avoiding
     crashing when the repo contains a filename ending in a carriage return.
+  * Document that settting preferred content to "" is the same as the
+    default unset behavior.
+  * sync: Avoid misleading warning about future preferred content
+    transition when preferred content is set to "".
 
  -- Joey Hess <id@joeyh.name>  Mon, 02 Dec 2024 13:41:31 -0400
 
index 1e38211260608855aec74b00309b8dcab98b5acf..c9436778bde4808edb7ef2919e6ace622b26dfb8 100644 (file)
@@ -85,6 +85,7 @@ import Utility.Bloom
 import Utility.OptParse
 import Utility.Process.Transcript
 import Utility.Tuple
+import Utility.Matcher
 
 import Control.Concurrent.MVar
 import qualified Data.Map as M
@@ -1130,7 +1131,7 @@ warnSyncContentTransition o remotes
                _ -> do
                        m <- preferredContentMap
                        hereu <- getUUID
-                       when (any (`M.member` m) (hereu:map Remote.uuid remotes)) $
+                       when (any (preferredcontentconfigured m) (hereu:map Remote.uuid remotes)) $
                                showwarning
   where
        showwarning = earlyWarning $
@@ -1140,6 +1141,8 @@ warnSyncContentTransition o remotes
                <> " send any content, use --no-content (or -g)"
                <> " to prepare for that change."
                <> " (Or you can configure annex.synccontent)"
+       preferredcontentconfigured m u = 
+               maybe False (not . isEmpty . fst) (M.lookup u m)
 
 notOnlyAnnex :: SyncOptions -> Annex Bool
 notOnlyAnnex o = not <$> onlyAnnex o
diff --git a/doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment b/doc/forum/Unable_to_delete_preferred-content.log/comment_3_ef3f7b7c14f44b79785ca9ab5b23ca0f._comment
new file mode 100644 (file)
index 0000000..4020bb7
--- /dev/null
@@ -0,0 +1,24 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2024-12-13T16:52:18Z"
+ content="""
+Ah, you're right that this future change in `git-annex sync` behavior is
+one way that "anything" is different from not configured.
+
+It turns out that you can just use `git-annex wanted here ""` to get back
+the same behavior as the preferred content being unset. I had forgotten
+about that, and it was not really documented anywhere, which I've
+corrected.
+
+Running `git-annex sync` without --content with preferred content set to ""
+currently warns about the transition, but that warning is false. I'm fixing
+it to not warn in this case.
+
+As to the heroic measures, .git/annex/index gets merged into whatever is in
+the git-annex branch, so you need to delete that file as well as rewriting
+the branch. And you need to do this in every single repository that has
+received the unwanted change. And since it also auto-merges git-annex
+branches from remotes, you probably will want to temporarily remove the
+remote tracking branches from git's ref list.
+"""]]
index 908b35a95f4b6ce6443a9449e969a62df2319c6c..68769484dc26ecc8e8a1e9913fe06314f52743ad 100644 (file)
@@ -30,6 +30,9 @@ a file matches, the repository wants to store its content. If it doesn't,
 the repository wants to drop its content (if there are enough copies
 elsewhere to allow removing it).
 
+An empty preferred content expression is treated the same as preferred
+content not being configured.
+
 # EXPRESSIONS
 
 * `include=glob` / `exclude=glob`